//
//  FireBaseUserProperty.swift
//  DaRings
//
//  Created by 尹琼 on 2023/2/24.
//

import UIKit



public struct FireBaseUserProperty {
    
 
    public var type: KeyType
    public var value: String
    
    public init(type: KeyType, value: Int) {
        
        self.type = type
        self.value = "\(value)"
    }
    
    public init(type: KeyType, value: Double) {
        
        self.type = type
        self.value = "\(Int(value))"
    }
    
    public init(type: KeyType, value: CGFloat) {
        
        self.type = type
        self.value = "\(Int(value))"
    }
    
    public init(type: KeyType, value: Bool) {
        
        self.type = type
        let strValue = value == true ? "1" : "0"
        self.value = strValue
    }
    
    public init(type: KeyType, value: String) {
        
        self.type = type
        self.value = value
    }
    
    
    
}

extension FireBaseUserProperty {
    
    
    public enum KeyType: String {
        
        /// 用户id
        case user_id = "user_id"
        
        /// 用户年龄
        case user_age = "user_age"
        
        /// 用户性别
        case user_gender  = "user_gender"
        
        /// 用户身高
        case user_height  = "user_height"
        
        /// 用户体重
        case user_weight  = "user_weight"
        
        /// 用户步长
        case user_step_size  = "user_step_size"
        
       public var name: String {
            
            return self.rawValue
        }
        
    }
    
}
